type MyStack struct {
    Queue []int
}


func Constructor() MyStack {
    return MyStack{
        Queue: make([]int, 0),
    }
}


func (this *MyStack) Push(x int)  {
    this.Queue = append(this.Queue, x)
}


func (this *MyStack) Pop() int {
    n := len(this.Queue)

    if n == 0 {
        return 0
    }

    for n-1 != 0 {
        val := this.Queue[0]
        this.Queue = this.Queue[1:]
        this.Queue = append(this.Queue, val)
        n--
    }
    
    val := this.Queue[0]
    this.Queue = this.Queue[1:]
    return val
}


func (this *MyStack) Top() int {
    val := this.Pop()
    this.Push(val)
    return val
}


func (this *MyStack) Empty() bool {
    return len(this.Queue) == 0
}


/**
 * Your MyStack object will be instantiated and called as such:
 * obj := Constructor();
 * obj.Push(x);
 * param_2 := obj.Pop();
 * param_3 := obj.Top();
 * param_4 := obj.Empty();
 */